class Student{
    String name;
    String no;
    //static声明的变量和方法不是存储在对象中的，而是存储在静态代码区中的，属于类，而不是对象
    static String classroom;

    Student(String name,String no) {
        this.name = name;
        this.no = no;
    }

    public void show() {
        System.out.println("name:"+name+",no:"+no);
    }
}

public class TestStudent {
    public static void main(String[] args) {
        Student s1 = new Student("小明","001");
        Student s2 = s1;
        //classroom是属于类的，不是属于对象的，我们调用的时候虽然可以使用对象来调用，但是在实际开发中，不能这样调用
        //static的方法或者属性需要使用类名来调用
//        s1.classroom = "23物联网";
        Student.classroom = "23物联网";
        s2.no = "002";
        s1.show();
        s2.show();
        System.out.println(Student.classroom);
//        System.out.println(s1.classroom);
//        System.out.println(s2.classroom);
        Student s3 = new Student("小王","003");
//        System.out.println(s3.classroom);
        s3.name = "小小王";
//        s3.classroom = "24物联网";
        Student.classroom = "25物联网";
        s3.show();
        System.out.println(Student.classroom);
        System.out.println(Student.classroom);
        System.out.println(Student.classroom);
//        System.out.println(s1.classroom);
//        System.out.println(s2.classroom);
//        System.out.println(s3.classroom);
    }
}
